Imports MIMS.WRS.Entities
Imports MIMS.WRS.Business

Public Class ResponsibleList
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents ddlConPoint As System.Web.UI.WebControls.DropDownList
    Protected WithEvents rptList As MyFramework.Web.UI.WebControls.Repeater
    Protected WithEvents crContent As MyFramework.Web.UI.WebControls.ContentRegion
    Protected WithEvents pageTitle As MyFramework.Web.UI.WebControls.ContentRegion
    Protected WithEvents Masterpage1 As MyFramework.Web.UI.WebControls.MasterPage
    Protected WithEvents btnOK As System.Web.UI.WebControls.Button

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Protected WithEvents ucPager As Pager

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Not IsPostBack Then
            ddlConPoint.DataSource = ConPointService.GetConPoints(ConPointColumns.Description, MyFramework.OrderDirection.ASC)
            ddlConPoint.DataTextField = ConPointColumns.Description.ToString()
            ddlConPoint.DataValueField = ConPointColumns.ConPointID.ToString()
            ddlConPoint.DataBind()
            ddlConPoint.Items.Insert(0, New ListItem("[All Conpoint]", "-1"))

            Try
                ddlConPoint.SelectedIndex = ddlConPoint.Items.IndexOf(ddlConPoint.Items.FindByValue(RequestContext.ConPointID.ToString()))
            Catch ex As Exception

            End Try
            Dim totalRecords As Integer
            ucPager.PageSize = Config.PageSize
            rptList.DataSource = ResponsibleService.GetResponsiblesByConPoint(Convert.ToInt32(ddlConPoint.SelectedItem.Value))
            rptList.DataBind()
            ucPager.TotalRecords = totalRecords
        End If
    End Sub

    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
        Response.Redirect(String.Format("ResponsibleList.aspx?cpid={0}", ddlConPoint.SelectedItem.Value))
    End Sub
End Class
